﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VinEmiCalculator
{
    public partial class EMI_Calculator : Form
    {
        private static EMI_Calculator _emicalculator;

        public static EMI_Calculator GetInstance()
        {
            if (_emicalculator == null)
                return _emicalculator= new EMI_Calculator();
            else
                return _emicalculator;
        }

        private EMI_Calculator()
        {
            InitializeComponent();
        }

        private void btnEMICalc_Click(object sender, EventArgs e)
        {
            EMILogic _emilogic = new EMILogic(Convert.ToDouble(txtLoanAmount.Text), Convert.ToDouble(txtInterest.Text), Convert.ToInt16(txtTenure.Text));
            _emilogic.CalculateEMI();
            txtEMI.Text =_emilogic.EMI.ToString();
        }
    }
}
